using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DeviceApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Bitmap b = new Bitmap(1024, 768);
            IntPtr dc1 = IntPtr.Zero;
            IntPtr dc2 = IntPtr.Zero;


            Graphics g = Graphics.FromImage(b);

            dc1 = g.GetHdc();
            dc2 = Api.GetWindowDC(IntPtr.Zero);

            Api.BitBlt(dc1, 0, 0, 1024, 768, dc2, 0, 0, Api.TernaryRasterOperations.SRCCOPY);

            g.ReleaseHdc(dc1);

            pictureBox1.Image = b;
        }
    }
}